<template>
  <div>
    <MUpload v-model="fileList">
      <el-button type="primary" v-if="fileList.length<3">Click to upload</el-button>
    </MUpload>
    <button @click="handleUpload">提交</button>
  </div>
</template>

<script setup>
import {ref} from 'vue'
import {upload} from '@/api/index.js'

const fileList = ref([{    name: 'food.jpeg',
  url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100',}])

function handleUpload() {
  // console.log(fileList.value)
/*  const data = {
    file: fileList.value[0].raw || fileList.value[0].url
  }*/
  console.log(fileList.value)
  // const data = new FormData()
  // data.append('file', fileList.value[0].raw || fileList.value[0].url)
  // upload(data).then(res => {
  //   console.log(res)
  // })
}
</script>


<style scoped lang="scss">

</style>